package org.admanager.acmepattern.plugin.diagram.part;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.admanager.acmepattern.plugin.diagram.providers.AcmeADManagementMetamodelElementTypes;
import org.eclipse.gef.Tool;
import org.eclipse.gef.palette.PaletteContainer;
import org.eclipse.gef.palette.PaletteDrawer;
import org.eclipse.gef.palette.PaletteRoot;
import org.eclipse.gef.palette.ToolEntry;
import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeConnectionTool;
import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCreationTool;

/**
 * @generated
 */
public class AcmeADManagementMetamodelPaletteFactory {

	/**
	 * @generated
	 */
	public void fillPalette(PaletteRoot paletteRoot) {
		paletteRoot.add(createPatternElement1Group());
		paletteRoot.add(createPatternConnector2Group());
		paletteRoot.add(createCBAElement3Group());
		paletteRoot.add(createCBAConnector4Group());
	}

	/**
	 * Creates "Pattern Element" palette tool group
	 * @generated
	 */
	private PaletteContainer createPatternElement1Group() {
		PaletteDrawer paletteContainer = new PaletteDrawer(
				Messages.PatternElement1Group_title);
		paletteContainer.setId("createPatternElement1Group"); //$NON-NLS-1$
		paletteContainer.add(createRole1CreationTool());
		paletteContainer.add(createConstraint2CreationTool());
		paletteContainer.add(createMultiplicity3CreationTool());
		return paletteContainer;
	}

	/**
	 * Creates "Pattern Connector" palette tool group
	 * @generated
	 */
	private PaletteContainer createPatternConnector2Group() {
		PaletteDrawer paletteContainer = new PaletteDrawer(
				Messages.PatternConnector2Group_title);
		paletteContainer.setId("createPatternConnector2Group"); //$NON-NLS-1$
		paletteContainer.add(createElementtoRole1CreationTool());
		paletteContainer.add(createElementtoMultiplicity2CreationTool());
		return paletteContainer;
	}

	/**
	 * Creates "CBA Element" palette tool group
	 * @generated
	 */
	private PaletteContainer createCBAElement3Group() {
		PaletteDrawer paletteContainer = new PaletteDrawer(
				Messages.CBAElement3Group_title);
		paletteContainer.setId("createCBAElement3Group"); //$NON-NLS-1$
		paletteContainer.add(createComponent1CreationTool());
		paletteContainer.add(createConnector2CreationTool());
		paletteContainer.add(createComponentPort3CreationTool());
		paletteContainer.add(createConnectorRole4CreationTool());
		return paletteContainer;
	}

	/**
	 * Creates "CBA Connector" palette tool group
	 * @generated
	 */
	private PaletteContainer createCBAConnector4Group() {
		PaletteDrawer paletteContainer = new PaletteDrawer(
				Messages.CBAConnector4Group_title);
		paletteContainer.setId("createCBAConnector4Group"); //$NON-NLS-1$
		paletteContainer.add(createComponentPorttoConnectorRole1CreationTool());
		paletteContainer.add(createComponentPorttoComponentPort2CreationTool());
		paletteContainer.add(createConnectorRoletoConnectorRole3CreationTool());
		return paletteContainer;
	}

	/**
	 * @generated
	 */
	private ToolEntry createRole1CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Role1CreationTool_title,
				Messages.Role1CreationTool_desc,
				Collections
						.singletonList(AcmeADManagementMetamodelElementTypes.PRole_2012));
		entry.setId("createRole1CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(AcmeADManagementMetamodelElementTypes
				.getImageDescriptor(AcmeADManagementMetamodelElementTypes.PRole_2012));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createConstraint2CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Constraint2CreationTool_title,
				Messages.Constraint2CreationTool_desc,
				Collections
						.singletonList(AcmeADManagementMetamodelElementTypes.PConstraint_3010));
		entry.setId("createConstraint2CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(AcmeADManagementMetamodelElementTypes
				.getImageDescriptor(AcmeADManagementMetamodelElementTypes.PConstraint_3010));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createMultiplicity3CreationTool() {
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Multiplicity3CreationTool_title,
				Messages.Multiplicity3CreationTool_desc,
				Collections
						.singletonList(AcmeADManagementMetamodelElementTypes.PMultiplicity_2011));
		entry.setId("createMultiplicity3CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(AcmeADManagementMetamodelElementTypes
				.getImageDescriptor(AcmeADManagementMetamodelElementTypes.PMultiplicity_2011));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createElementtoRole1CreationTool() {
		LinkToolEntry entry = new LinkToolEntry(
				Messages.ElementtoRole1CreationTool_title,
				Messages.ElementtoRole1CreationTool_desc,
				Collections
						.singletonList(AcmeADManagementMetamodelElementTypes.PElementRoles_4006));
		entry.setId("createElementtoRole1CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(AcmeADManagementMetamodelDiagramEditorPlugin
				.findImageDescriptor("/org.admanager.acmeadmanagement.plugin/icons/full/obj16/Relationship.gif")); //$NON-NLS-1$
		entry.setLargeIcon(AcmeADManagementMetamodelDiagramEditorPlugin
				.findImageDescriptor("/org.admanager.acmedmanagement.plugin/icons/full/obj16/Relationship.gif")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createElementtoMultiplicity2CreationTool() {
		LinkToolEntry entry = new LinkToolEntry(
				Messages.ElementtoMultiplicity2CreationTool_title,
				Messages.ElementtoMultiplicity2CreationTool_desc,
				Collections
						.singletonList(AcmeADManagementMetamodelElementTypes.PElementMultiplicity_4007));
		entry.setId("createElementtoMultiplicity2CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(AcmeADManagementMetamodelDiagramEditorPlugin
				.findImageDescriptor("/org.admanager.acmeadmanagement.plugin/icons/full/obj16/Relationship.gif")); //$NON-NLS-1$
		entry.setLargeIcon(AcmeADManagementMetamodelDiagramEditorPlugin
				.findImageDescriptor("/org.admanager.acmeadmanagement.plugin/icons/full/obj16/Relationship.gif")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createComponent1CreationTool() {
		ArrayList/*[org.eclipse.gmf.runtime.emf.type.core.IElementType]*/types = new ArrayList/*[org.eclipse.gmf.runtime.emf.type.core.IElementType]*/(
				2);
		types.add(AcmeADManagementMetamodelElementTypes.PComponent_2007);
		types.add(AcmeADManagementMetamodelElementTypes.PComponent_3006);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Component1CreationTool_title,
				Messages.Component1CreationTool_desc, types);
		entry.setId("createComponent1CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(AcmeADManagementMetamodelElementTypes
				.getImageDescriptor(AcmeADManagementMetamodelElementTypes.PComponent_2007));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createConnector2CreationTool() {
		ArrayList/*[org.eclipse.gmf.runtime.emf.type.core.IElementType]*/types = new ArrayList/*[org.eclipse.gmf.runtime.emf.type.core.IElementType]*/(
				2);
		types.add(AcmeADManagementMetamodelElementTypes.PConnector_3008);
		types.add(AcmeADManagementMetamodelElementTypes.PConnector_2009);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.Connector2CreationTool_title,
				Messages.Connector2CreationTool_desc, types);
		entry.setId("createConnector2CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(AcmeADManagementMetamodelElementTypes
				.getImageDescriptor(AcmeADManagementMetamodelElementTypes.PConnector_3008));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createComponentPort3CreationTool() {
		ArrayList/*[org.eclipse.gmf.runtime.emf.type.core.IElementType]*/types = new ArrayList/*[org.eclipse.gmf.runtime.emf.type.core.IElementType]*/(
				2);
		types.add(AcmeADManagementMetamodelElementTypes.PComponentPort_3007);
		types.add(AcmeADManagementMetamodelElementTypes.PComponentPort_2008);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.ComponentPort3CreationTool_title,
				Messages.ComponentPort3CreationTool_desc, types);
		entry.setId("createComponentPort3CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(AcmeADManagementMetamodelElementTypes
				.getImageDescriptor(AcmeADManagementMetamodelElementTypes.PComponentPort_3007));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createConnectorRole4CreationTool() {
		ArrayList/*[org.eclipse.gmf.runtime.emf.type.core.IElementType]*/types = new ArrayList/*[org.eclipse.gmf.runtime.emf.type.core.IElementType]*/(
				2);
		types.add(AcmeADManagementMetamodelElementTypes.PConnectorRole_3009);
		types.add(AcmeADManagementMetamodelElementTypes.PConnectorRole_2010);
		NodeToolEntry entry = new NodeToolEntry(
				Messages.ConnectorRole4CreationTool_title,
				Messages.ConnectorRole4CreationTool_desc, types);
		entry.setId("createConnectorRole4CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(AcmeADManagementMetamodelElementTypes
				.getImageDescriptor(AcmeADManagementMetamodelElementTypes.PConnectorRole_3009));
		entry.setLargeIcon(entry.getSmallIcon());
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createComponentPorttoConnectorRole1CreationTool() {
		LinkToolEntry entry = new LinkToolEntry(
				Messages.ComponentPorttoConnectorRole1CreationTool_title,
				Messages.ComponentPorttoConnectorRole1CreationTool_desc,
				Collections
						.singletonList(AcmeADManagementMetamodelElementTypes.PComponentPortAttachedRole_4009));
		entry.setId("createComponentPorttoConnectorRole1CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(AcmeADManagementMetamodelDiagramEditorPlugin
				.findImageDescriptor("/org.admanager.acmeadmanagement.plugin/icons/full/obj16/Relationship.gif")); //$NON-NLS-1$
		entry.setLargeIcon(AcmeADManagementMetamodelDiagramEditorPlugin
				.findImageDescriptor("/org.admanager.acmeadmanagement.plugin/icons/full/obj16/Relationship.gif")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createComponentPorttoComponentPort2CreationTool() {
		LinkToolEntry entry = new LinkToolEntry(
				Messages.ComponentPorttoComponentPort2CreationTool_title,
				Messages.ComponentPorttoComponentPort2CreationTool_desc,
				Collections
						.singletonList(AcmeADManagementMetamodelElementTypes.PComponentPortDelegatedPorts_4008));
		entry.setId("createComponentPorttoComponentPort2CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(AcmeADManagementMetamodelDiagramEditorPlugin
				.findImageDescriptor("/org.admanager.acmeadmanagement.plugin/icons/full/obj16/Relationship.gif")); //$NON-NLS-1$
		entry.setLargeIcon(AcmeADManagementMetamodelDiagramEditorPlugin
				.findImageDescriptor("/org.admanager.acmeadmanagement.plugin/icons/full/obj16/Relationship.gif")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private ToolEntry createConnectorRoletoConnectorRole3CreationTool() {
		LinkToolEntry entry = new LinkToolEntry(
				Messages.ConnectorRoletoConnectorRole3CreationTool_title,
				Messages.ConnectorRoletoConnectorRole3CreationTool_desc,
				Collections
						.singletonList(AcmeADManagementMetamodelElementTypes.PConnectorRoleDelegatedRoles_4010));
		entry.setId("createConnectorRoletoConnectorRole3CreationTool"); //$NON-NLS-1$
		entry.setSmallIcon(AcmeADManagementMetamodelDiagramEditorPlugin
				.findImageDescriptor("/org.admanager.acmeadmanagement.plugin/icons/full/obj16/Relationship.gif")); //$NON-NLS-1$
		entry.setLargeIcon(AcmeADManagementMetamodelDiagramEditorPlugin
				.findImageDescriptor("/org.admanager.acmeadmanagement.plugin/icons/full/obj16/Relationship.gif")); //$NON-NLS-1$
		return entry;
	}

	/**
	 * @generated
	 */
	private static class NodeToolEntry extends ToolEntry {

		/**
		 * @generated
		 */
		private final List/*[org.eclipse.gmf.runtime.emf.type.core.IElementType]*/elementTypes;

		/**
		 * @generated
		 */
		private NodeToolEntry(
				String title,
				String description,
				List/*[org.eclipse.gmf.runtime.emf.type.core.IElementType]*/elementTypes) {
			super(title, description, null, null);
			this.elementTypes = elementTypes;
		}

		/**
		 * @generated
		 */
		public Tool createTool() {
			Tool tool = new UnspecifiedTypeCreationTool(elementTypes);
			tool.setProperties(getToolProperties());
			return tool;
		}
	}

	/**
	 * @generated
	 */
	private static class LinkToolEntry extends ToolEntry {

		/**
		 * @generated
		 */
		private final List/*[org.eclipse.gmf.runtime.emf.type.core.IElementType]*/relationshipTypes;

		/**
		 * @generated
		 */
		private LinkToolEntry(
				String title,
				String description,
				List/*[org.eclipse.gmf.runtime.emf.type.core.IElementType]*/relationshipTypes) {
			super(title, description, null, null);
			this.relationshipTypes = relationshipTypes;
		}

		/**
		 * @generated
		 */
		public Tool createTool() {
			Tool tool = new UnspecifiedTypeConnectionTool(relationshipTypes);
			tool.setProperties(getToolProperties());
			return tool;
		}
	}
}
